// pages/personcenter/personcenter.js

var route = require('../../utils/route');
var config = require('../../config/config');
var httpClient = require('../../utils/httpClient');
//index.js
//获取应用实例
const app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
	  balance:null
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    app.getUserInfo(function (res) {
      that.setData({
        userInfo: res
      });
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
	  this.getAccount()
  },
  list: function (event) {
    wx.switchTab({
      url: '../myrecord/myrecord'
    })
  },
  widthdraw: function (event) {
    wx.switchTab({
      url: '../widthdraw/widthdraw'
    })
  },
  question: function (event) {
    wx.navigateTo({
      url: '../question/question'
    })
  },
  
  getAccount: function () {
	  	var that = this;
		var method = route.getAccount();
		debugger
		 var params = {
				 openId: app.globalData.openId,
	      	    };
		 httpClient.request(method, 'GET', params, function (res, err) {
			 debugger;
			that.setData({
				balance: res
			});
	    }); 
  }
})